package test_annotation_context;

import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

import test_annotation_context.biz.Rectangle;

public class MyImportRegistrar implements ImportBeanDefinitionRegistrar {

    @Override
    public void registerBeanDefinitions( //
            AnnotationMetadata annotationMetadata, BeanDefinitionRegistry beanDefinitionRegistry //
    ) {
        RootBeanDefinition rootBeanDefinition = new RootBeanDefinition( Rectangle.class );
        // 注册一个名字叫做 rectangle 的 bean
        beanDefinitionRegistry.registerBeanDefinition( "rectangle", rootBeanDefinition );
    }

}
